package org.amj.wn;

public class SchemaItem {
	
	public enum UIOptions {label, text, textarea, combo, hidden}
	
	private final Renderer renderer;
	private final UIElement uiElement;
	private final String caption;
	private final UIOptions uiOption;
	private final String[] values;
	private final String key;

	public Renderer getRenderer() {
		return renderer;
	}

	private SchemaItem(UIElement uiElement, String caption, String key, UIOptions uiOption, String... values) {
		this.uiElement = uiElement;
		this.caption = caption;
		this.key = key;
		this.uiOption = uiOption;
		this.values = values;
		this.renderer = new Renderer(this);
	}

	public static SchemaItem page(String caption) {
		return new SchemaItem(UIElement.PAGE, caption, null, null);
	}
	
	public static SchemaItem section(String caption) {
		return new SchemaItem(UIElement.SECTION, caption, null, null);
	}
	
	public static SchemaItem field(String caption, String key, UIOptions ui, String... values) {
		
		return new SchemaItem(UIElement.FIELD, caption, key, ui, values);
	}

	public UIElement getUiElement() {
		return uiElement;
	}

	public String getCaption() {
		return caption;
	}

	public UIOptions getUiOption() {
		return uiOption;
	}

	public String[] getValues() {
		return values;
	}

	public String getKey() {
		return key;
	}
	

	
}
